import java.util.ArrayList;

public class Voiture
{
    // instance variables - replace the example below with your own
    private String couleur;
    private String nomModele;
    private ArrayList<Composant>  listComposant;

    /**
     * Constructor for objects of class Voiture
     */
    public Voiture()
    {
    }
    /**
     * Constructor for objects of class Voiture
     */
    public Voiture(String c, String nomM)
    {
        // initialise instance variables
        this.couleur = c;
        this.nomModele = nomM;
        this.listComposant = new ArrayList<Composant> ();
    }
    
    public Voiture(String c)
    {
    	this.couleur = c;
    	this.listComposant = new ArrayList<Composant> ();
    }
    
    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
    public void setCouleur(String c)
    {
        // put your code here
        this.couleur = c;
    }
    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
    public String getCouleur()
    {
        // put your code here
        return this.couleur;
    }
    
    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
    public String getNomModele()
    {
        // put your code here
        return this.nomModele;
    }
    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
    public void setNomModele(String nomM)
    {
        // put your code here
        this.nomModele = nomM;
    }
        /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
    public ArrayList<Composant> getlistComposant()
    {
        // put your code here
        return this.listComposant;
    }
   
    
    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
    public void setComposant(ArrayList<Composant> tab)
    {
        // put your code here
        this.listComposant = tab;
    }
    
    
    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
    public void addComposant(Composant c)
    {
        // put your code here
        this.listComposant.add(c);
    }
    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */

    
    /*public String toString(){
    	String strRetour = "La voiture est de type : " + this.getNomModele() + "et de couleur : " + this.getCouleur() + "\n Ces composants sont : ";
    	for (Composant c : listComposant)
            strRetour += "\n" + c.toString();
    	return strRetour;
    }*/
    
    public boolean equals(Object v0){
    	Voiture v = (Voiture) v0;
    	if (v.getCouleur().equals(this.getCouleur()) && v.getNomModele().equals(this.getNomModele()))
    		return true;
    	else
    		return false;
    }

    
}